import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'
import { List } from 'echarts/lib/export'

// 同步路由
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/auth-redirect'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    meta: {
      roles: ['superAdmin', 'admin']
    },
    redirect: '/dashboard1',
    children: [
      {
        path: 'dashboard1',
        component: () => import('@/views/dashboard1/index'),
        name: 'Dashboard',
        meta: { title: '概览', icon: 'dashboard', affix: true }
      }
    ]
  },
  // 个人信息
  {
    path: '/profile',
    component: Layout,
    redirect: '/profile/index',
    hidden: true,
    children: [
      {
        path: 'index',
        component: () => import('@/views/profile/index'),
        name: 'Profile',
        meta: { title: '个人中心', icon: 'user', noCache: true }
      }
    ]
  },

]

// 异步路由
export const asyncRoutes = [
  //基础信息
  {
    path: '/adminManage',
    component: Layout,
    meta: {
      roles: ['superAdmin']
    },
    children: [
      {
        path: 'index',
        component: () => import('@/views/admin-manage/index'),
        name: 'adminManage',
        meta: {
          title: '基础信息',
          icon: 'edit'
        }
      }
    ]
  },
  //用户管理
  {
    path:'/user-management',
    component: Layout,
    meta: {
      roles: ['superAdmin', 'admin', 'adminn'],
      title: '用户管理',
      icon: 'list'
    },
    children:[
      // {
      //   //管理员管理
      //   path: 'admin-management',
      //   component: () => import('@/views/user-management/admin-management/index'),
      //   name: 'admin-management',
      //   meta: {
      //     title: '管理员管理'
      //   }
      // },
      {
        //住户管理
        path: 'residents-management',
        component: () => import('@/views/user-management/residents-management/index'),
        name: 'residents-management',
        meta: {
          title: '宿舍管理'
        }
      }
    ]
  },
  // //分组
  // {
  //   path: '/roomInfo',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin']
  //   },
  //   children: [
  //     {
  //       path: 'floor',
  //       component: () => import('@/views/floor/text.vue'),
  //       name: 'floorManage',
  //       meta: {
  //         title: '分组管理',
  //         icon: 'peoples'
  //       }
  //     },
  //   ]
  // },
  // //收费模板
  // {
  //   path: '/moneytemplate',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin']
  //   },
  //   children: [
  //     {
  //       path: 'moneytemplate',
  //       component: () => import('@/views/moneytemplate/index.vue'),
  //       name: 'floorManage',
  //       meta: {
  //         title: '收费模板',
  //         icon: 'component'
  //       }
  //     },

  //   ]
  // },
  //   //资产管理
  //   {
  //     path: '/asset',
  //     component: Layout,
  //     meta: {
  //       roles: ['superAdmin','admin']
  //     },
  //     children: [
  //       {
  //         path: 'asset',
  //         component: () => import('@/views/asset/index.vue'),
  //         name: 'asset',
  //         meta: {
  //           title: '资产管理',
  //           icon: 'money'
  //         }
  //       },

  //     ]
  //   },
  //   //用户管理
  //   {
  //     path: '/tenant',
  //     component: Layout,
  //     name: 'tenant',
  //     meta: {
  //       roles: ['superAdmin'],
  //       title: '用户管理',
  //       icon: 'documentation'
  //     },
  //     children: [
  //       {
  //         path: 'user',
  //         component: () => import('@/views/user/index'),
  //         name: 'user',
  //         meta: {
  //           title: '用户信息',
  //           icon: 'edit'
  //         }
  //       },
  //       {
  //         path: 'tenant',
  //         component: () => import('@/views/tenant/index'),
  //         name: 'tenant',
  //         meta: {
  //           title: '住客记录',
  //           icon: 'clipboard'
  //         }
  //       },

  //     ]
  //   },
  // //公寓管理
  // {
  //   path: '/floorManage',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin', 'admin'],
  //     title: '公寓管理',
  //     icon: 'list'
  //   },
  //   children: [
  //     {
  //       path: 'floor-manage',
  //       component: () => import('@/views/floor-manage/index'),
  //       name: 'floorManage',
  //       meta: {
  //         title: '楼层管理',
  //         icon: 'list'
  //       }
  //     },
  //     {
  //       path: 'room-info',
  //       component: () => import('@/views/room-info/index'),
  //       name: 'roomInfo',
  //       meta: {
  //         title: '入住管理',
  //         icon: 'peoples'
  //       }
  //     },
  //     {
  //       path: 'user-info',
  //       component: () => import('@/views/user-info/index'),
  //       name: 'userInfo',
  //       meta: {
  //         title: '退宿管理',
  //         icon: 'people'
  //       }
  //     }
  //   ]
  // },
  // //租金管理
  // {
  //   path: '/rent-info',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin', 'admin'],
  //     title: '租金管理',
  //     icon: 'money'
  //   },
  //   children: [
  //     {
  //       path: 'rent-info',
  //       component: () => import('@/views/rent-info/index'),
  //       name: 'rent-info',
  //       meta: {
  //         title: '租金信息',
  //         icon: 'message'
  //       }
  //     },
  //     {
  //       path: 'order-info',
  //       component: () => import('@/views/order-info/index'),
  //       name: 'order-info',
  //       meta: {
  //         title: '订单列表',
  //         icon: 'nested'
  //       }
  //     },
  //     {
  //       path: 'report',
  //       component: () => import('@/views/report-summary/index.vue'),
  //       name: 'reportSummary',
  //       meta: {
  //         title: '报表汇总',
  //         icon: 'excel'
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/contractInfo',
  //   component: Layout,
  //   name: 'contractManage',
  //   meta: {
  //     roles: ['superAdmin'],
  //     title: '合同管理',
  //     icon: 'documentation'
  //   },
  //   children: [
  //     {
  //       path: 'create',
  //       component: () => import('@/views/create-contract/index'),
  //       name: 'createContract',
  //       meta: {
  //         title: '创建合同',
  //         icon: 'edit'
  //       }
  //     },
  //     {
  //       path: 'check',
  //       component: () => import('@/views/check-contract/index'),
  //       name: 'checkContract',
  //       meta: {
  //         title: '查看合同',
  //         icon: 'clipboard'
  //       }
  //     },
  //     // {
  //     //   path: 'text',
  //     //   component: () => import('@/views/charts/mix-chart.vue'),
  //     //   name: 'text',
  //     //   meta: {
  //     //     title: '测试',
  //     //     icon: 'text'
  //     //   }
  //     // }
  //   ]
  // },
  // {
  //   path: '/charts',
  //   component: Layout,
  //   name: 'charts',
  //   meta: {
  //     roles: ['superAdmin'],
  //     title: '测试',
  //     icon: 'documentation'
  //   },
  //   children: [
  //     {
  //       path: 'text',
  //       component: () => import('@/views/charts/mix-chart.vue'),
  //       name: 'text',
  //       meta: {
  //         title: '测试',
  //         icon: 'text'
  //       }
  //     }
  //   ]
  // },
  //报表统计
  {
    path: '/report',
    component: Layout,
    meta: {
      roles: ['superAdmin', 'admin', 'adminn'],
      title: '报表统计',
      icon: 'list'
    },
    children: [
      {
        // 用量统计分类
        path: 'usage',
        meta: {
          roles: ['superAdmin', 'admin', 'adminn'],
          title: '用量统计',
          icon: 'list'
        },
        component: () => import('@/views/usage/index'),
        children: [
          {
            path: 'meter-report',
            component: () => import('@/views/meter-report/index'),
            name: 'meter-report',
            meta: {
              title: '电表用量统计',
            }
          },
          {
            path: 'cold-water-statistics',
            component: () => import('@/views/cold-water-statistics/index'),
            name: 'cold-water-statistics',
            meta: {
              title: '冷水用量统计',
            }
          },
          {
            path: 'hot-water-a-statistics',
            component: () => import('@/views/hot-water-a-statistics/index'),
            name: 'hot-water-a-statistics',
            meta: {
              title: '热水用量统计',
            }
          },
          // {
          //   path: 'hot-water-b-statistics',
          //   component: () => import('@/views/hot-water-b-statistics/index'),
          //   name: 'hot-water-b-statistics',
          //   meta: {
          //     title: '热水B用量统计',
          //   }
          // }
        ]
      },
      {
        // 补助统计分类
        path: 'subsidy-statistics',// 假设您有一个用于补助统计的布局组件
        meta: {
          roles: ['superAdmin', 'admin', 'adminn'],
          title: '补助统计',
          icon: 'list'
        },
        component: () => import('@/views/subsidy-statistics/index'),
        children: [
          {
            path: 'subsidy-report',
            component: () => import('@/views/subsidy-report/index'),
            name: 'subsidy-report',
            meta: {
              title: '电表补助统计',
            }
          },
          {
            path: 'cold-water-subsidy-statistics',
            component: () => import('@/views/cold-water-subsidy-statistics/index'),
            name: 'cold-water-subsidy-statistics',
            meta: {
              title: '冷水补助统计',
            }
          },
        ]
      },
      {
        // 充值统计
        path: 'recharge-statistics',
        meta: {
          roles: ['superAdmin', 'admin', 'adminn'],
          title: '充值统计',
          icon: 'list'
        },
        component: () => import('@/views/recharge-statistics/index'),
        children: [
          {
            path: 'electric-recharge-statistics',
            component: () => import('@/views/electric-recharge-statistics/index'),
            name: 'electric-recharge-statistics',
            meta: {
              title: '电表充值统计',
            }
          },
          {
            path: 'cold-water-recharge-statistics',
            component: () => import('@/views/cold-water-recharge-statistics/index'),
            name: 'cold-water-recharge-statistics',
            meta: {
              title: '冷水充值统计',
            }
          },
          {
            path: 'hot-water-recharge-statistics',
            component: () => import('@/views/hot-water-recharge-statistics/index'),
            name: 'hot-water-recharge-statistics',
            meta: {
              title: '热水充值统计',
            }
          },
               ]
      },
      {
        // 记录管理
        path: 'recharge',// 假设您有一个用于补助统计的布局组件
        meta: {
          roles: ['superAdmin', 'admin', 'adminn'],
          title: '记录管理',
          icon: 'list'
        },
        component: () => import('@/views/recharge/index'),
        children: [
          {
            path: 'recharge-record',
            meta: {
              roles: ['superAdmin', 'admin', 'adminn'],
              title: '充值记录',
              icon: 'list'
            },
            component: () => import('@/views/recharge-record/index'),
            children: [
              {
                path: '/record-recharge',
                component: () => import('@/views/recharge-record/recharge/index'),
                name: 'record-recharge',
                meta: {
                  title: '电表充值记录',
                }
              },
              {
                path: '/cold-water-recharge-record',
                component: () => import('@/views/recharge-record/cold-water-recharge-record/index'),
                name: 'record-cold-water-recharge-record',
                meta: {
                  title: '冷水充值记录',
                }
              },
              {
                path: '/hot-water-a-recharge-record',
                component: () => import('@/views/recharge-record/hot-water-a-recharge-record/index'),
                name: 'hot-water-a-recharge-record',
                meta: {
                  title: '热水表充值记录',
                }
    
              },
              // {
              //   path: '/hot-water-b-recharge-record',
              //   component: () => import('@/views/recharge-record/hot-water-b-recharge-record/index'),
              //   name: 'hot-water-b-recharge-record',
              //   meta: {
              //     title: '热水B表充值记录',
              //   }
    
              // },
    
    
            ]
          },
          {
            path: 'record-subsidy',
            meta: {
              roles: ['superAdmin', 'admin', 'adminn'],
              title: '补助记录',
              icon: 'list'
            },
            component: () => import('@/views/record-subsidy/index'),
            children: [
              {
                path: '/subsidy-record',
                component: () => import('@/views/record-subsidy/subsidy-record/index'),
                name: 'subsidy-record',
                meta: {
                  title: '电表补助记录',
                }
              },
              {
                path: '/cold-water-subsidy-record',
                component: () => import('@/views/record-subsidy/cold-water-subsidy-record/index'),
                name: 'cold-water-subsidy-record',
                meta: {
                  title: '冷水补助记录',
                }
    
              },
    
            ]
          },
          {
            //异常记录
            path: 'record-exception',
            meta: {
              roles: ['superAdmin', 'admin', 'adminn'],
              title: '异常记录',
              icon: 'list'
            },
            component: () => import('@/views/record-exception/index'),
            children: [
              {
                //电表异常记录 meter-abnormal-record
                path: '/meter-abnormal-record',
                component: () => import('@/views/record-exception/meter-abnormal-record/index'),
                name: 'meter-abnormal-record',
                meta: {
                  title: '电表异常记录',
                }
              },{
                //冷水异常记录 cold-water-abnormal-record
                path: '/cold-water-abnormal-record',
                component: () => import('@/views/record-exception/cold-water-abnormal-record/index'),
                name: 'cold-water-abnormal-record',
                meta: {
                  title: '冷水异常记录',
                }
              },{
                //热水异常记录 hot-water-abnormal-record
                path: '/hot-water-abnormal-record',
                component: () => import('@/views/record-exception/hot-water-abnormal-record/index'),
                name: 'hot-water-abnormal-record',
                meta: {
                  title: '热水异常记录',
                }
              }
            ]
          }
        ]
      },
      {
        //操作日志
        path: 'operation-log',
        component: () => import('@/views/operation-log/index'),
        name: 'operation-log',
        meta: {
          title: '操作日志'
        }
      },
      {
        path: 'text',
        component: () => import('@/views/charts/mix-chart.vue'),
        name: 'text',
        meta: {
          title: '表格统计',
        }
      }
    ]
  },
 
  //设备管理
  {
    path: '/water',
    component: Layout,
    meta: {
      roles: ['superAdmin', 'admin', 'adminn'],
      title: '设备管理',
      icon: 'list'
    },
    
        children:
          [{
            path: 'cold-water-equipment-management',
            component: () => import('@/views/cold-water-equipment-management/index'),
            name: 'cold-water-equipment-management',
            meta: {
              title: '冷水设备管理',
            },
           

          },
          {
            path: 'meter',
            component: () => import('@/views/meter/index'),
            name: 'meter',
            meta: {
              title: '电表设备管理',
            }
          },
          {
            path: 'hot-water-a-equipment-management',
            component: () => import('@/views/hot-water-a-equipment-management/index'),
            name: 'hot-water-a-equipment-management',
            meta: {
              title: '热水设备管理',
            }
          },
          // {
          //   path: 'cold-water-control-management',
          //   component: () => import('@/views/cold-water-control-management/index'),
          //   name: 'cold-water-control-management',
          //   meta: {
          //     title: '冷水总控管理',
          //   }
          // },
          // {
          //   path: 'cold-water-subsidy-management',
          //   component: () => import('@/views/cold-water-subsidy-management/index'),
          //   name: 'cold-water-subsidy-management',
          //   meta: {
          //     title: '冷水补助管理',
          //   }

          // },
          ]
      
    
  },
  
  //记录管理
  // {
  //   path: '/recharge',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin', 'admin', 'adminn'],
  //     title: '记录管理',
  //     icon: 'list'
  //   },
  //   children: [
  //     {
  //       path: 'recharge-record',
  //       meta: {
  //         roles: ['superAdmin', 'admin', 'adminn'],
  //         title: '充值记录',
  //         icon: 'list'
  //       },
  //       component: () => import('@/views/recharge-record/index'),
  //       children: [
  //         {
  //           path: '/record-recharge',
  //           component: () => import('@/views/recharge-record/recharge/index'),
  //           name: 'record-recharge',
  //           meta: {
  //             title: '电表充值记录',
  //           }
  //         },
  //         {
  //           path: '/cold-water-recharge-record',
  //           component: () => import('@/views/recharge-record/cold-water-recharge-record/index'),
  //           name: 'record-cold-water-recharge-record',
  //           meta: {
  //             title: '冷水充值记录',
  //           }
  //         },
  //         {
  //           path: '/hot-water-a-recharge-record',
  //           component: () => import('@/views/recharge-record/hot-water-a-recharge-record/index'),
  //           name: 'hot-water-a-recharge-record',
  //           meta: {
  //             title: '热水表充值记录',
  //           }

  //         },
  //         // {
  //         //   path: '/hot-water-b-recharge-record',
  //         //   component: () => import('@/views/recharge-record/hot-water-b-recharge-record/index'),
  //         //   name: 'hot-water-b-recharge-record',
  //         //   meta: {
  //         //     title: '热水B表充值记录',
  //         //   }

  //         // },


  //       ]
  //     },
  //     {
  //       path: 'record-subsidy',
  //       meta: {
  //         roles: ['superAdmin', 'admin', 'adminn'],
  //         title: '补助记录',
  //         icon: 'list'
  //       },
  //       component: () => import('@/views/record-subsidy/index'),
  //       children: [
  //         {
  //           path: '/subsidy-record',
  //           component: () => import('@/views/record-subsidy/subsidy-record/index'),
  //           name: 'subsidy-record',
  //           meta: {
  //             title: '电表补助记录',
  //           }
  //         },
  //         {
  //           path: '/cold-water-subsidy-record',
  //           component: () => import('@/views/record-subsidy/cold-water-subsidy-record/index'),
  //           name: 'cold-water-subsidy-record',
  //           meta: {
  //             title: '冷水补助记录',
  //           }

  //         },

  //       ]
  //     },
  //     {
  //       //异常记录
  //       path: 'record-exception',
  //       meta: {
  //         roles: ['superAdmin', 'admin', 'adminn'],
  //         title: '异常记录',
  //         icon: 'list'
  //       },
  //       component: () => import('@/views/record-exception/index'),
  //       children: [
  //         {
  //           //电表异常记录 meter-abnormal-record
  //           path: '/meter-abnormal-record',
  //           component: () => import('@/views/record-exception/meter-abnormal-record/index'),
  //           name: 'meter-abnormal-record',
  //           meta: {
  //             title: '电表异常记录',
  //           }
  //         },{
  //           //冷水异常记录 cold-water-abnormal-record
  //           path: '/cold-water-abnormal-record',
  //           component: () => import('@/views/record-exception/cold-water-abnormal-record/index'),
  //           name: 'cold-water-abnormal-record',
  //           meta: {
  //             title: '冷水异常记录',
  //           }
  //         },{
  //           //热水异常记录 hot-water-abnormal-record
  //           path: '/hot-water-abnormal-record',
  //           component: () => import('@/views/record-exception/hot-water-abnormal-record/index'),
  //           name: 'hot-water-abnormal-record',
  //           meta: {
  //             title: '热水异常记录',
  //           }
  //         }
  //       ]
  //     }
  //   ]
  // },
  
  //收费基础
  // {
  //   path:'/charge',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin', 'admin', 'adminn'],
  //     title: '收费基础',
  //     icon: 'list'
  //   },
  //   children:[
  //     {
  //       path: 'hot-water-charge',
  //       component: () => import('@/views/hot-water-charge/index'),
  //       name: 'hot-water-charge',
  //       meta: {
  //         title: '热水收费',
  //       }

  //     },{
  //       path: 'cold-water-charge',
  //       component: () => import('@/views/cold-water-charge/index'),
  //       name: 'cold-water-charge',
  //       meta: {
  //         title: '冷水收费',
  //       }

  //     },{
  //       path: 'electricity-charge',
  //       component: () => import('@/views/electricity-charge/index'),
  //       name: 'electricity-charge',
  //       meta: {
  //         title: '电表收费',
  //       }

  //     },
  //   ]
  // },
  //充值管理
  {
    path:'/recharge-management',
    component: Layout,
    meta: {
      roles: ['superAdmin', 'admin', 'adminn'],
      title: '充值管理',
      icon: 'list'
    },
    children:[
      {
        path: 'electric-meter-recharge-management',
        component: () => import('@/views/electric-meter-recharge-management/index'),
        name: 'electric-meter-recharge-management',
        meta: {
          title: '电表充值管理',
        }

      },{
        path: 'cold-water-recharge-management',
        component: () => import('@/views/cold-water-recharge-management/index'),
        name: 'cold-water-recharge-management',
        meta: {
          title: '冷水充值管理',
        }

      },{
        path: 'hot-water-recharge-management',
        component: () => import('@/views/hot-water-recharge-management/index'),
        name: 'hot-water-recharge-management',
        meta: {
          title: '热水充值管理',
        }

      },
    ]
  },
  //模板管理
  // {
  //   path:'template-management',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin', 'admin', 'adminn'],
  //     title: '模板管理',
  //     icon: 'list'
  //   },
  //   children:[
  //     {
  //       //补助模板
  //       path: 'subsidy-template',
  //       component: () => import('@/views/subsidy-template/index'),
  //       meta:{
  //         title: '补助模板',
  //         icon:'list'
  //       },
  //       children:[
  //         {
  //           path:'/electric-meter-subsidy-template',//电表补助模板
  //           component: () => import('@/views/subsidy-template/electric-meter-subsidy-template/index'),
  //           name:'electric-meter-subsidy-template',
  //           meta:{
  //             title: '电表补助模板',
  //           }
  //         },{
  //           path:'/cold-water-subsidy-template',//冷水补助模板
  //           component: () => import('@/views/subsidy-template/cold-water-subsidy-template/index'),
  //           name:'cold-water-subsidy-template',
  //           meta:{
  //             title: '冷水补助模板',
  //           }
  //         }
  //       ]

  //     },{
  //       //收费模板
  //       path: 'charge-template',
  //       component: () => import('@/views/charge-template/index'),
  //       meta:{
  //         title: '收费模板',
  //         icon:'list'
  //       },
  //       children:[
  //         {
  //           path:'/electric-meter-charge-template',//电表收费模板
  //           component: () => import('@/views/charge-template/electric-meter-charge-template/index'),
  //           name:'electric-meter-charge-template',
  //           meta:{
  //             title: '电表收费模板',
  //           }
  //         },{
  //           path:'/cold-water-charge-template',//冷水收费模板
  //           component: () => import('@/views/charge-template/cold-water-charge-template/index'),
  //           name:'cold-water-charge-template',
  //           meta:{
  //             title: '冷水收费模板',
  //           }
  //         },{
  //           path:'/hot-water-charge-template',//热水收费模板
  //           component: () => import('@/views/charge-template/hot-water-charge-template/index'),
  //           name:'hot-water-charge-template',
  //           meta:{
  //             title: '热水收费模板',
  //           }
  //         }
  //       ]
  //     }


  //   ]

  // },
//总控管理
{
  path:'/general-control-management',
  component: Layout,
  meta: {
    roles: ['superAdmin', 'admin', 'adminn'],
    title: '总控管理',
    icon: 'list'
  },
  children:[
    {
      path: 'all-device',
      component: () => import('@/views/all-device/index'),
      name: 'all-device',
      meta: {
        title: '电表总控管理',
      }
    },
    {
      path: 'cold-water-control-management',
      component: () => import('@/views/cold-water-control-management/index'),
      name: 'cold-water-control-management',
      meta: {
        title: '冷水总控管理',
      }
    },

    {
      path: 'hot-water-a-control-management',
      component: () => import('@/views/hot-water-a-control-management/index'),
      name: 'hot-water-a-control-management',
      meta: {
        title: '热水总控管理',
      }

    },
 

  ]

},
  //模板管理
  {
    path:'template-management',
    component: Layout,
    meta: {
      roles: ['superAdmin', 'admin', 'adminn'],
      title: '模板管理',
      icon: 'list'
    },
    children:[
      {
        path:'/electric-meter-subsidy-template',//电表补助模板
        component: () => import('@/views/subsidy-template/electric-meter-subsidy-template/index'),
        name:'electric-meter-subsidy-template',
        meta:{
          title: '补助模板',
        }
      },

      {
        path:'/electric-meter-charge-template',//电表收费模板
        component: () => import('@/views/charge-template/electric-meter-charge-template/index'),
        name:'electric-meter-charge-template',
        meta:{
          title: '收费模板',
        }
      },
   

    ]

  },
  



  // 学生专属页面 =========================
  // {
  //   path: '/getupRecord',
  //   component: Layout,
  //   meta: {
  //   },
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/getup-record/index'),
  //       name: 'getupRecord',
  //       meta: {
  //         title: '起床记录',
  //         icon: 'eye-open'
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/backRecord',
  //   component: Layout,
  //   meta: {
  //     roles: ['student']
  //   },
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/back-record/index'),
  //       name: 'backRecord',
  //       meta: {
  //         title: '归宿记录',
  //         icon: 'eye'
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/cleanRecord',
  //   component: Layout,
  //   meta: {
  //     roles: ['student']
  //   },
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/clean-record/index'),
  //       name: 'cleanRecord',
  //       meta: {
  //         title: '打扫记录',
  //         icon: 'theme'
  //       }
  //     }
  //   ]
  // },
  //  管理员路由 =========================

  //楼栋管理
  // {
  //   path: '/buildingManage',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin']
  //   },
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/building-manage/index'),
  //       name: 'cleanRecord',
  //       meta: {
  //         title: '楼栋管理',
  //         icon: 'international'
  //       }
  //     }
  //   ]
  // },

  // {
  //   path: '/userInfo',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin', 'admin']
  //   },
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/user-info/index'),
  //       name: 'userInfo',
  //       meta: {
  //         title: '学生信息',
  //         icon: 'people'
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/recordManage',
  //   component: Layout,
  //   meta: {
  //     roles: ['superAdmin', 'admin'],
  //     title: '记录查看',
  //     icon: 'tree'
  //   },
  //   children: [
  //     {
  //       path: '/recordManage/getup',
  //       component: () => import('@/views/record-manage/getup-record-manage'),
  //       name: 'getupRecordManage',
  //       meta: {
  //         title: '起床记录'
  //       }
  //     },
  //     {
  //       path: '/recordManage/back',
  //       component: () => import('@/views/record-manage/back-record-manage'),
  //       name: 'backRecordManage',
  //       meta: {
  //         title: '归宿记录'
  //       }
  //     },
  //     {
  //       path: '/recordManage/clean',
  //       component: () => import('@/views/record-manage/clean-record-manage'),
  //       name: 'cleanRecordManage',
  //       meta: {
  //         title: '清扫记录',
  //         noCache: true
  //       }
  //     }
  //   ]
  // },
  // 404 页面要在最后引入
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  })

const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
